package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.RolePermission;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface RolePermissionMapper extends BaseMapper<RolePermission> {

    @Results({
            @Result(property = "permissionId",column = "permissionId"),
            @Result(property = "permission",column = "permissionId",
            one = @One(select = "com.example.demo.mapper.PermissionMapper.selectPermissionById"))
    })
    @Select("select * from role_permission where roleId = #{roleId}")
    List<RolePermission> selectPermissonIdByRoleId(Integer roleId);
}
